#include <stdio.h>
#include <stdlib.h>

int un_g_val;
int g_val = 100;


int main(int argc, char *argv[], char *env[])
{

    int i = 0;

    //字面常量
    char *str = "hello";

    //static修饰的静态变量
    static int a = 10;

    printf("code addr: %p\n", main);
    printf("init global addr: %p\n", &g_val);
    printf("uninit global addr: %p\n", &un_g_val);

    char *heap = (char*)malloc(10);
    char *heap1 = (char*)malloc(10);
    char *heap2 = (char*)malloc(10);
    char *heap3 = (char*)malloc(10);

    printf("heap addr: %p\n", heap);
    printf("heap1 addr: %p\n", heap1);
    printf("heap2 addr: %p\n", heap2);
    printf("heap3 addr: %p\n", heap3);
   
    printf("stack addr: %p\n", &heap);
    printf("stack1 addr: %p\n", &heap1);
    printf("stack2 addr: %p\n", &heap2);
    printf("stack3 addr: %p\n", &heap3);

    printf("read only string addr: %p\n", str);
    printf("static addr: %p\n", &a);

    for(i = 0; i < argc; i++)
    {
        printf("argv[%d]: %p\n", i, argv[i]);
    }

    for(i = 0; env[i]; i++)
    {
        printf("env[%d]: %p\n", i, env[i]);
    }

    return 0;

}
